﻿using System;
using System.IO;
using System.Web;
using JPR.Common;

namespace JPR.TunelProxy.ProxyWeb
{
    public class ProxyListener : IHttpHandler
    {
        #region IHttpHandler Members

        public bool IsReusable
        {
            get { return true; }
        }

        public void ProcessRequest(HttpContext context)
        {
            TryProcessRequestInternal(context);
        }

        private void TryProcessRequestInternal(HttpContext context)
        {
            try
            {
                ProcessRequestInternal(context);
            }
            catch (Exception ex)
            {
                //Logger.WriteException(ex);
                context.Response.Close();
            }
        }

        private void ProcessRequestInternal(HttpContext context)
        {
        }

        #endregion

        private static void SendFakeResponse(Stream stream)
        {
            stream.WriteLine("HTTP/1.1 204 No Content");
            stream.WriteLine();
            stream.Flush();
        }
    }
}